
using System;
using Gnome;
using System.Collections;
using Gdk;

namespace LibLienzo
{
	
	
	abstract public class Figura
	{
	
		private bool _debug = false;
	
		protected bool _bIn = false;
		protected bool _bDrag=false;
	
	
		#region "Puntos de Control"
		protected ArrayList _p;
		#endregion
	
		#region "Color"
		private string _foreColor;
		private string _backColor;
		#endregion
		
		private uint _borderSize;
		
		public enum FiguraType { Conector, Circulo, Rectangulo, Rombo, Romboide }
		public abstract FiguraType Type
		{
			get;
		}
		
		public Figura()
		{
			this._backColor = "#00ff00";
			this._foreColor = "#000000";
			
			this._borderSize = 2;
		}
		
		public abstract string toString();
		public abstract void draw(Canvas c);
		public  Gdk.Point GetPoint()
		{
			return new Point(0,0);
		}
		
		protected virtual string ForeColor 
		{ 
			set { this._foreColor = value; ChangeColor(); }
			get { return this._foreColor; }
		}
		protected virtual string BackColor 
		{ 
			set { this._backColor = value; ChangeColor(); } 
			get { return this._backColor; }
		}
		protected virtual uint BorderSize 
		{ 
			set { this._borderSize = value; } 
			get { return this._borderSize; }
		}
		
		public bool Debug
		{
			set { this._debug = value; }
			get { return this._debug; }
		}
		
		protected abstract void ChangeColor();
		
		protected virtual void MouseEnter(object obj, Gnome.CanvasEventArgs args)
		{
			this._bIn = true;
			for ( int i = 0; i < this._p.Count; i++)
				((Gnome.CanvasEllipse)this._p[i]).Show();
		
			ChangeColor();
		}
		
		protected virtual void MouseLeave(object obj, Gnome.CanvasEventArgs args)
		{
			this._bIn = false;
			for ( int i = 0; i < this._p.Count; i++)
				((Gnome.CanvasEllipse)this._p[i]).Hide();
			ChangeColor();
		}
		
		protected virtual void Write(string msj)
		{
			if (this._debug) 
			{
				Console.WriteLine(msj);
			}
		}
	}
}
